import {getDetail , getSearchGoods} from '@/api/detail'

const state = {
    // 商品详情数据
    goodInfo:{
    
    },
}
const actions = {
    // 获取商品详情数据
    async getDetailData({commit},id){
        let res = await getDetail(id);
        if(res.status==true){
            commit('GETDETAILDATA',res.data)
        }
    },
    async getSearchGoodsData({commit},value){
        let res = await getSearchGoods(value);
        if(res.status==true){
            commit('GETDETAILDATA',res.data)
        }
    },
}
const mutations = {
    GETDETAILDATA(state,goodInfo){
        state.goodInfo = goodInfo;
    },
}
const getters = {}
export default {
    namespaced:true,
    state,
    actions,
    mutations,
    getters,
}
